package com.ljkj.lawyer.lawyer.dao;

import com.ljkj.lawyer.lawyer.entity.CommerceEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface CommerceDao extends JpaRepository<CommerceEntity, Integer> {

    @Query(value = "select * from commerce order by create_time desc",nativeQuery = true)
    Page<CommerceEntity> getCommerceList( Pageable pageable);

    CommerceEntity findByMemberId(Integer memberId);

    @Query(value = "select * from commerce where member_id = ?1 order by create_time desc",nativeQuery = true)
    Page<CommerceEntity> searchCommerceListByMemberId(Integer memberId,Pageable pageable);

    @Query(value = "select * from commerce where enterprise_name like %?1% order by create_time desc",nativeQuery = true)
    Page<CommerceEntity> searchCommerceListByKeyWord(String keyWord,Pageable pageable);
}
